package com.tianzeculture.stagebao.activity.mine;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tianzeculture.stagebao.R;
import com.tianzeculture.stagebao.bean.ResumesBean;

import java.util.List;

import static com.tianzeculture.stagebao.net.base.AppBaseRestUsageV2.PICTURE_URL;

/**
 * Created by Administrator on 2018/8/31.
 */

public class ResumeAdapter extends BaseQuickAdapter<ResumesBean, BaseViewHolder> {
    Context context;
    List<ResumesBean> data;

    public ResumeAdapter(@LayoutRes int layoutResId, @Nullable List<ResumesBean> data, Context context) {
        super(layoutResId, data);
        this.context = context;
        this.data = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, ResumesBean item) {
        ImageView imageView = helper.getView(R.id.iv_header);
        Glide.with(context).load(PICTURE_URL + item.getImgurl()).placeholder(R.mipmap.icon_head).error(R.mipmap.icon_head).into(imageView);
        helper.setText(R.id.tv_name, item.getNickname());
        helper.setText(R.id.tv_meet, item.getName());
        helper.setText(R.id.tv_work_type, item.getAddress() + "|" + item.getIndustryId() + "|" + item.getAge()+"岁");
        helper.setText(R.id.tv_post, "投递岗位: " + item.getTitle());
        helper.setText(R.id.tv_time, "投递时间: " + item.getSpplyTime());
    }

    public void setList(List<ResumesBean> list) {
        data = list;
        setNewData(data);
    }
}
